home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-25 | 5.1 KB | 166 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: GroupShp.h
- // Release Version: $ ODF 1 $
- //
- // Author: Mary Boetcher
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef GROUPSHP_H
- #define GROUPSHP_H
-
- #ifndef CONSTANT_H
- #include "Constant.h"
- #endif
-
- #ifndef BASESHP_H
- #include "BaseShp.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWINK_H
- #include "FWInk.h"
- #endif
-
- #ifndef FWSTYLE_H
- #include "FWStyle.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- // ----- Foundation Layer -----
-
- #ifndef FWRUNTYP_H
- #include "FWRunTyp.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class ODFacet;
- class ODShape;
- class CDrawPart;
- class FW_CGraphicContext;
- class FW_CMouseEvent;
-
- class CDrawFacetClipper;
- class CUngroupShapesCommand;
- class CShapeCollectionIterator;
- class CDrawContent;
-
- //========================================================================================
- // class CGroupShape
- //========================================================================================
-
- class CGroupShape : public CBaseShape
- {
- public:
- FW_DECLARE_CLASS
- FW_DECLARE_AUTO(CGroupShape)
-
- public:
- CGroupShape();
- CGroupShape(CShapeCollection* shapeList);
- CGroupShape(FW_CReadableStream& archive);
- virtual ~CGroupShape();
-
- // ----- Archiving -----
- static void* Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
- virtual void Flatten(FW_CWritableStream& archive);
-
- // ----- Required CBaseShape overrides -----
- virtual ODShape* CreateShapeOutline(Environment* ev);
- virtual void GetClipRegion(Environment* ev, ODShape* clipRegion);
- virtual void GetHandleCenter(short whichHandle, FW_CPoint& center) const;
- virtual void GetMapRects(short whichHandle, const FW_CPoint& lastLocation,
- FW_CRect& srcRect, FW_CRect& dstRect);
- virtual FW_CRect GetRectGeometry() const;
- virtual FW_Boolean HitTest(Environment* ev, FW_CGraphicContext& gc, const FW_CMouseEvent& theMouseEvent) const;
- virtual void MapShape(Environment* ev, CDrawPart* part, const FW_CRect& srcRect, const FW_CRect& dstRect);
- virtual void OffsetShape(Environment* ev, FW_Fixed xDelta, FW_Fixed yDelta);
- virtual void RenderShape(Environment* ev, ODFacet* facet, FW_CGraphicContext& gc);
- virtual void ResizeFeedback(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style,
- short whichHandle, const FW_CPoint& mouseLoc);
- virtual void SetShapeGeometry(const FW_CPoint& anchorPoint, const FW_CPoint& currentPoint);
-
- // ----- Other CBaseShape overrides -----
- virtual void Removed(Environment* ev);
- virtual void SelectShape(Environment* ev, FW_Boolean state);
- virtual void SubtractToWindowClip(Environment* ev,
- CDrawFacetClipper* facetClipper,
- ODFacet* containingFacet,
- ODShape* windowClip,
- ODShape* tempShape);
-
- virtual void SetSubscribeLink(Environment* ev, CDrawSubscribeLink* subscribeLink);
-
- // ----- Shape shifting -----
- virtual void ChangeFrameColor(Environment* ev, CDrawPart* part, const FW_CColor& color);
- virtual void ChangeFramePattern(Environment* ev, CDrawPart* part, const FW_CPattern& pattern);
- virtual void ChangeFillColor(Environment* ev, CDrawPart* part, const FW_CColor& color);
- virtual void ChangeFillPattern(Environment* ev, CDrawPart* part, const FW_CPattern& pattern);
- virtual void ChangePenSize(Environment* ev, CDrawPart* part, FW_Fixed newPenSize);
- virtual void ChangeRenderVerb(Environment* ev, CDrawPart* part, unsigned short renderVerb);
-
- // ----- Shape list operations -----
- void AddShape(CBaseShape* shape);
- unsigned long CountShapes() const;
- void EmptyShapes(FW_Boolean deleteShapes);
- CBaseShape* GetFirstShape() const;
- void RemoveShapes();
- void Remove1Shape(CBaseShape* shape);
-
- CShapeCollection* GetShapeList();
-
- private:
- void OutlineShape(FW_CGraphicContext& gc, const FW_CInk& ink, const FW_CStyle& style, const FW_CRect& rect);
-
- private:
- CShapeCollection* fShapeList; // list of CBaseShape*
- };
-
- //----------------------------------------------------------------------------------------
- inline CShapeCollection* CGroupShape::GetShapeList()
- {
- return fShapeList;
- }
-
- //========================================================================================
- // class CAllShapeIterator - iterate grouped shapes recursively
- //========================================================================================
-
- class CAllShapeIterator
- {
- public:
- FW_DECLARE_AUTO(CAllShapeIterator)
-
- CAllShapeIterator(CShapeCollection* shapeList);
- CAllShapeIterator(CDrawContent* content);
- ~CAllShapeIterator();
-
- CBaseShape* First();
- CBaseShape* Next();
- FW_Boolean IsNotComplete();
-
- unsigned long CountShapes();
-
- private:
- void PrivFlattenList(CShapeCollection* shapeList);
-
- CShapeCollectionIterator* fIter;
- CShapeCollection* fTempList; // flattened list - temporary
- };
-
- #endif
-